package com.kaibes.module.file.local.api;

import java.math.BigInteger;
import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kaibes.core.base.annotation.Description;
import com.kaibes.module.file.local.db.FileInfo;
import com.kaibes.module.file.local.db.FileInfoService;
import com.kaibes.web.api.ApiLink;
import com.kaibes.web.api.ResponseApi;

@RestController
@RequestMapping("/files/infos")
public class FileInfoApi extends ResponseApi<FileInfo, FileInfoService> {

    @ApiLink("删除文件，根据id")
    @DeleteMapping
    public ResponseEntity<Object> delete(@RequestBody @Description("文件信息ID数组") List<Long> ids) {
        return super.deleteByIds(ids, "删除文件成功", "删除文件失败");
    }
    
    @ApiLink("删除文件，根据id")
    @DeleteMapping("/{id:\\d+}")
    public ResponseEntity<Object> delete(@PathVariable @Description("文件信息ID") BigInteger id) {
        return super.deleteById(id, "删除文件成功", "删除文件失败");
    }
    
}
